<script type="text/javascript">
{literal}$(document).ready(function(){
    $('[name="category"]').change(function() {
        if ($('[name=category]:checked').val()=='Nova') {
            $('#new_category').removeAttr('disabled');
        }
        else {
            $('#new_category').attr('disabled','disabled');
        }
    });
{/literal}
    if ('{$singlePost.kategorija}' !='0' ) {literal}{{/literal}

                    $('[value="{$singlePost.kategorija}"]').attr('checked', 'true');
{literal}
    }
                    
});
{/literal}
</script>

<div class="page">

    <div class="sidebar_page">
        <form action="handlers/hmagazin_admin.php" method="post">
            <div class="content">
                <div id="articles">
                    <div class="page_capt clearfix">
                        <div class="fl_left">
                            <h2>Dodaj novi članak</h2>
                        </div>
                    </div>
                    <div id="naslov">
                        <label for="title">Naslov</label>
                        <input type="text" name="naslov" value="{$singlePost.naslov|escape }" class="required" />
                    </div>
                    <textarea id="single_post" name="clanak" rows="30" cols="105" class="required">
                        {$singlePost.tekst}
                    </textarea>
                    <input type="hidden" name="username" value="{$user.username}" />
                    <input type="hidden" name="post_id" value="{$singlePost.id}" />
                    <input id="btnPostavi" type="submit" name="postavi" value="Postavi" />
                </div>
            </div>
            <div class="sidebar">
                <div id="category" class="rblock">
                    <h3>Kategorija:</h3>
                    <input type="radio" name="category" value="Nekategorizovano" checked="checked">Nekategorizovano <br />
                    {foreach from=$categories item='category'}
                        <input type="radio" name="category" value="{$category.kategorija}">{$category.kategorija}<br />
                    {/foreach}
                    <input type="radio" name="category" value="Nova">Unesi novu kategoriju<br />
                    <input type="text" name="new_category" disabled="disabled" id="new_category" />
                </div>
                <div id="clanak" class="rblock">
                    <h3>Izmeni članak:</h3>
                    <ul class="editposts">
                    {foreach from=$postTitles item="postTitle"}
                        <li><a href="{$url}/?page=magazin_admin&p={$postTitle.id}">{$postTitle.naslov}</a></li>
                    {/foreach}
                    </ul>
                </div>
            </div>
        </form>
    </div>

</div>